
package com.engine4cloud.tdf.education.convert;

import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.education.dto.result.EduStudyTaskResultDTO;
import com.engine4cloud.tdf.education.entity.EduStudyTaskEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;


@Mapper
public interface EduStudyTaskConvert {
    EduStudyTaskConvert INSTANCE = Mappers.getMapper(EduStudyTaskConvert.class);

    EduStudyTaskResultDTO convert(EduStudyTaskEntity s);

    EduStudyTaskEntity createTo(String courseCode, String groupCode, String resourceCode, String studentCode);

    default EduStudyTaskEntity create(String courseCode, String groupCode, String resourceCode, String studentCode, Long tenantId) {
        EduStudyTaskEntity entity = createTo(courseCode, groupCode, resourceCode, studentCode);
        entity.setCode(CodeUtils.entrustCode());
        entity.setTenantId(tenantId);
        return entity;
    }
}
